<template>
    <div>
        <div class="xh-check" v-for="(item, index) in actionList">
            <v-action :action="item" :index="index" :exceptions="exceptions"></v-action>
        </div>
    </div>
</template>

<script>
import { get, post } from '@/utils/request.js';
import vAction from "./Action";

export default {
    data() {
        return {
            exceptions: {},
            tipVisible: false,
            actionList: []
        };
    },
    components: {
        vAction
    },
    props: ['chosenItem'],
    mounted() {

    },
    watch: {
        chosenItem: {
            handler (newValue, oldValue) {
                if (oldValue != newValue) {
                    this.loadAction(newValue);
                }
            },
            //deep: true,// 可以深度检测到对象的属性值的变化
            immediate: true//刷新加载 立马触发一次handler
        }
    },
    methods: {

        loadAction(actionid) {
            if(actionid == undefined) return;
            this.actionList = [];
            get('/esbview/v-action/list/' + actionid, '').then(res => {
                // this.actionList = res.list;
                this.$set(this, "actionList", res.list);
            });
            get('/esbview/v-action/exceptions/' + actionid, '').then(res => {
                this.exceptions = res.exceptions;
                if (this.exceptions == undefined) {
                    this.exceptions = {};
                }
            });
        }
    }
};
</script>

<style lang="scss" scoped>
$iconbg: #a9b1c8;
$borderColor: #e4e7f0;
$actBorderColor: #ffc5b9;
$actColor: #f58e7a;
.check-warpper {
    position: relative;
    padding: 15px 20px;

    .top2 {
        color: $actColor;
    }
}
</style>